import ajax from './index'



export function retail_product_cat_list(condition) {
    if(!condition) {
        condition = {
            page: 1,
            num: 100
        }
    }
    return ajax({
        url: "/backend/retail/product_category/list",
        method: "get",
        params: condition
    });
}

export function retail_product_cat_add(param) {
    return ajax({
        url: "/backend/retail/product_category/create",
        method: "post",
        data: param
    });
}

export function retail_product_cat_edit(id, param) {
    return ajax({
        url: "/backend/retail/product_category/update/" + id,
        method: "post",
        data: param
    });
}

export function retail_product_cat_del(id) {
    return ajax({
        url: "/backend/retail/product_category/delete?ids=" + id,
        method: "post"
    });
}

export function retail_product_cat_detail(id) {
    return ajax({
        url: "/backend/retail/product_category/detail/" + id,
        method: "get"
    });
}

export function retail_product_cat_tree(parentId) {
    return ajax({
        url: "/backend/retail/product_category/tree/" + parentId,
        method: "get"
    });
}
export function retail_product_category(pid) {
    return ajax({
        url: "/backend/retail/product_category/listAll" + "/" + pid,
        method: "get"
    });
}
export function retail_product_list(condition) {
    if(!condition) {
        condition = {
            pageNum: 1,
            pageSize: 100
        }
    }
    return ajax({
        url: "/backend/retail_product/list",
        method: "get",
        params: condition
    });
}

export function retail_product_save(param) {
    return ajax({
        url: "/backend/retail_product/save",
        method: "post",
        data: param
    });
}

export function retail_product_edit(param) {
    return ajax({
        url: "/backend/retail_product/edit",
        method: "post",
        data: param
    });
}

export function retail_product_detail(id) {
    return ajax({
        url: "/backend/retail_product/detail" + "/" + id,
        method: "get"
    });
}
export function retail_product_delete(id) {
    return ajax({
        url: "/backend/retail_product/delete" + "/" + id,
        method: "post"
    });
}

export function retail_product_update_order(param) {
    return ajax({
        url: "/backend/retail_product/update_order",
        method: "post",
        data: param
    });
}

export function retail_product_up(param) {
    return ajax({
        url: "/backend/retail_product/up",
        method: "post",
        data: param
    });
}

export function retail_product_down(param) {
    return ajax({
        url: "/backend/retail_product/down",
        method: "post",
        data: param
    });
}

export function retail_product_page_relate_list(pageId, condition) {
    if(!condition) {
        condition = {
            page: 1,
            num: 100
        }
    }
    return ajax({
        url: "/backend/retail_product/pageRelateList/" + pageId,
        method: "get",
        params: condition
    });
}

export function retail_order_list(condition) {
    if(!condition) {
        condition = {
            pageNum: 1,
            pageSize: 100
        }
    }
    return ajax({
        url: "/backend/retail_product/orderList",
        method: "get",
        params: condition
    });
}

export function retail_order_settle(ids) {
    return ajax({
        url: "/backend/retail_product/orderSettle",
        method: "post",
        data: {
            ids: ids
        }
    });
}

export function retail_order_in(ids) {
    return ajax({
        url: "/backend/retail_product/orderIn",
        method: "post",
        data: {
            ids: ids
        }
    });
}

export function retail_order_sync(data) {
    return ajax({
        url: "/backend/retail_product/sync",
        method: "post",
        data: data
    });
}

export function retail_brand_cat_list(condition) {
    if(!condition) {
        condition = {
            pageNum: 1,
            pageSize: 200
        }
    }
    return ajax({
        url: "/backend/retail_product/brandCategoryList",
        method: "get",
        params: condition
    });
}

export function retail_brand_cat_del(id) {
    return ajax({
        url: "/backend/retail_product/brandCategoryDelete/" + id,
        method: "post"
    });
}

export function retail_brand_cat_detail(id) {
    return ajax({
        url: "/backend/retail_product/brandCategoryDetail/" + id,
        method: "get"
    });
}

export function retail_brand_cat_save(data) {
    return ajax({
        url: "/backend/retail_product/brandCategorySave",
        method: "post",
        data: data,
    });
}



export function retail_brand_list(condition) {
    if(!condition) {
        condition = {
            pageNum: 1,
            pageSize: 200
        }
    }
    return ajax({
        url: "/backend/retail_product/brandList",
        method: "get",
        params: condition
    });
}

export function retail_brand_del(id) {
    return ajax({
        url: "/backend/retail_product/brandDelete/" + id,
        method: "post"
    });
}

export function retail_brand_detail(id) {
    return ajax({
        url: "/backend/retail_product/brandDetail/" + id,
        method: "get"
    });
}

export function retail_brand_save(data) {
    return ajax({
        url: "/backend/retail_product/brandSave",
        method: "post",
        data: data,
    });
}

export function retail_brand_cat_all(params) {
    return ajax({
        url: "/backend/retail_product/brandCategoryAll",
        method: "get",
        params: params
    });
}

export function retail_brand_ad_list(id) {
    return ajax({
        url: "/backend/retail_product/brandAdList/" + id,
        method: "get"
    });
}

export function retail_brand_ad_save(data) {
    return ajax({
        url: "/backend/retail_product/brandAdSave",
        method: "post",
        data: data,
    });
}

export function retail_brand_commend_list(id) {
    return ajax({
        url: "/backend/retail_product/brandCommendList/" + id,
        method: "get"
    });
}

export function retail_brand_commend_save(data) {
    return ajax({
        url: "/backend/retail_product/brandCommendSave",
        method: "post",
        data: data,
    });
}

export function retail_product_brand_relate_list(brandCid, condition) {
    if(!condition) {
        condition = {
            pageNum: 1,
            pageSize: 200
        }
    }
    return ajax({
        url: "/backend/retail_product/brandRelateList/" + brandCid,
        method: "get",
        params: condition
    });
}

export function retail_brand_cid_detail(id) {
    return ajax({
        url: "/backend/retail_product/brandCidDetail/" + id,
        method: "get"
    });
}
export function retail_product_add_to_brand(param) {
    return ajax({
        url: "/backend/retail_product/addToBrand",
        method: "post",
        data: param
    });
}
export function retail_product_remove_from_brand(param) {
    return ajax({
        url: "/backend/retail_product/removeFromBrand",
        method: "post",
        data: param
    });
}

export function retail_product_update_brand_order(param) {
    return ajax({
        url: "/backend/retail_product/updateBrandOrder",
        method: "post",
        data: param
    });
}

export function retail_product_update_brand_commend_order(param) {
    return ajax({
        url: "/backend/retail_product/updateBrandCommendOrder",
        method: "post",
        data: param
    });
}

export function retail_product_update_brand_status(param) {
    return ajax({
        url: "/backend/retail_product/updateBrandStatus",
        method: "post",
        data: param
    });
}